package android.slc.box.core.notification;

public interface SaxSysNotificationObserver<T> extends de.saxsys.mvvmfx.utils.notifications.NotificationObserver {
    @Override
    default void receivedNotification(String key, Object... payload) {
        receivedNotificationPlus(key, getResultByView(payload));
    }

    void receivedNotificationPlus(String key, T payload);

    @SuppressWarnings("unchecked")
    static <T> T getResultByView(Object... payload) {
        if (payload != null && payload.length > 0) {
            return (T) payload[0];
        }
        return null;
    }
}